#ifndef USERDATA_H
#define USERDATA_H

#ifndef Q_MOC_RUN
#include <bsoncxx/json.hpp>
#include <bsoncxx/builder/stream/document.hpp>
#include <mongocxx/client.hpp>
#include <mongocxx/cursor.hpp>
#include <mongocxx/stdx.hpp>
#include <mongocxx/uri.hpp>
#endif

#include <QGlobalStatic>
#include <QVector>

#define USERDATA_MOGO HIM::UserData::instance()

enum UserKey
{
    USERID=0,
    ACCOUNT=1,
    ROLE=2,
    User_Creation_Time=3,
    Last_Login_Time=4,
    PASSWORD=5
};


namespace HIM {

class UserData
{
public:
    explicit UserData();
    ~UserData(){};

public:
    static UserData* instance();

public:
    int getUserCount();
    void addUser(std::map<std::string,std::string> userNew);
    void deleteUser(std::string deId);
    void updateUser(std::string upId , std::map<std::string,std::string> userUpdata);
    void updateSingleValue(UserKey filtel_key, std::string filtel_Value , UserKey up_key, std::string up_value);
    void loadUser(std::vector<std::vector<std::string>>&);
    std::string getValue(UserKey filtel_key, std::string filtel_Value , std::string get_Key);
    bool findAccount(std::string accountValue);
    std::vector<std::string> UserKeyLists={"UserID","Account","Role",
                                        "Creation Time","Last Login Time","Password"};

};

}
#endif // USERDATA_H
